home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  5.2 KB  |  185 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Contains:    Time Manager interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1985-1993, 1995-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TIMER__
  18. #define __TIMER__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21.     #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #ifndef __MACTYPES__
  25.     #include <MacTypes.h>
  26. #endif
  27.  
  28. #ifndef __OSUTILS__
  29.     #include <OSUtils.h>
  30. #endif
  31.  
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. enum {
  56.                                                                 /* high bit of qType is set if task is active */
  57.     kTMTaskActive                = (1L << 15)
  58. };
  59.  
  60. typedef struct TMTask                     TMTask;
  61. typedef TMTask *                        TMTaskPtr;
  62. typedef CALLBACK_API( void , TimerProcPtr )(TMTaskPtr tmTaskPtr);
  63. /*
  64.     WARNING: TimerProcPtr uses register based parameters under classic 68k
  65.              and cannot be written in a high-level language without 
  66.              the help of mixed mode or assembly glue.
  67. */
  68. typedef REGISTER_UPP_TYPE(TimerProcPtr)                         TimerUPP;
  69.  
  70. struct TMTask {
  71.     QElemPtr                         qLink;
  72.     short                             qType;
  73.     TimerUPP                         tmAddr;
  74.     long                             tmCount;
  75.     long                             tmWakeUp;
  76.     long                             tmReserved;
  77. };
  78.  
  79.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  80.                                                                                             #pragma parameter InsTime(__A0)
  81.                                                                                             #endif
  82. EXTERN_API( void )
  83. InsTime                            (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA058);
  84.  
  85.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  86.                                                                                             #pragma parameter InsXTime(__A0)
  87.                                                                                             #endif
  88. EXTERN_API( void )
  89. InsXTime                        (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA458);
  90.  
  91.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  92.                                                                                             #pragma parameter PrimeTime(__A0, __D0)
  93.                                                                                             #endif
  94. EXTERN_API( void )
  95. PrimeTime                        (QElemPtr                 tmTaskPtr,
  96.                                  long                     count)                                ONEWORDINLINE(0xA05A);
  97.  
  98.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  99.                                                                                             #pragma parameter RmvTime(__A0)
  100.                                                                                             #endif
  101. EXTERN_API( void )
  102. RmvTime                            (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA059);
  103.  
  104.  
  105. /* InstallTimeTask, InstallXTimeTask, PrimeTimeTask and RemoveTimeTask work */
  106. /* just like InsTime, InsXTime, PrimeTime, and RmvTime except that they */
  107. /* return an OSErr result. */
  108.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  109.                                                                                             #pragma parameter __D0 InstallTimeTask(__A0)
  110.                                                                                             #endif
  111. EXTERN_API( OSErr )
  112. InstallTimeTask                    (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA058);
  113.  
  114.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  115.                                                                                             #pragma parameter __D0 InstallXTimeTask(__A0)
  116.                                                                                             #endif
  117. EXTERN_API( OSErr )
  118. InstallXTimeTask                (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA458);
  119.  
  120.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  121.                                                                                             #pragma parameter __D0 PrimeTimeTask(__A0, __D0)
  122.                                                                                             #endif
  123. EXTERN_API( OSErr )
  124. PrimeTimeTask                    (QElemPtr                 tmTaskPtr,
  125.                                  long                     count)                                ONEWORDINLINE(0xA05A);
  126.  
  127.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  128.                                                                                             #pragma parameter __D0 RemoveTimeTask(__A0)
  129.                                                                                             #endif
  130. EXTERN_API( OSErr )
  131. RemoveTimeTask                    (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA059);
  132.  
  133.  
  134. EXTERN_API( void )
  135. Microseconds                    (UnsignedWide *            microTickCount)                        FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  136.  
  137. #if OPAQUE_UPP_TYPES
  138.     EXTERN_API(TimerUPP)
  139.     NewTimerUPP                       (TimerProcPtr            userRoutine);
  140.  
  141.     EXTERN_API(void)
  142.     DisposeTimerUPP                   (TimerUPP                userUPP);
  143.  
  144.     EXTERN_API(void)
  145.     InvokeTimerUPP                   (TMTaskPtr                tmTaskPtr,
  146.                                     TimerUPP                userUPP);
  147.  
  148. #else
  149.     enum { uppTimerProcInfo = 0x0000B802 };                         /* register no_return_value Func(4_bytes:A1) */
  150.     #define NewTimerUPP(userRoutine)                                 (TimerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  151.     #define DisposeTimerUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  152.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  153.     #pragma parameter InvokeTimerUPP(__A1, __A0)
  154.     void InvokeTimerUPP(TMTaskPtr tmTaskPtr, TimerUPP userUPP) = 0x4E90;
  155.     #else
  156.         #define InvokeTimerUPP(tmTaskPtr, userUPP)                         CALL_ONE_PARAMETER_UPP((userUPP), uppTimerProcInfo, (tmTaskPtr))
  157.     #endif
  158. #endif
  159. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  160. #define NewTimerProc(userRoutine)                                 NewTimerUPP(userRoutine)
  161. #define CallTimerProc(userRoutine, tmTaskPtr)                    InvokeTimerUPP(tmTaskPtr, userRoutine)
  162.  
  163.  
  164.  
  165. #if PRAGMA_STRUCT_ALIGN
  166.     #pragma options align=reset
  167. #elif PRAGMA_STRUCT_PACKPUSH
  168.     #pragma pack(pop)
  169. #elif PRAGMA_STRUCT_PACK
  170.     #pragma pack()
  171. #endif
  172.  
  173. #ifdef PRAGMA_IMPORT_OFF
  174. #pragma import off
  175. #elif PRAGMA_IMPORT
  176. #pragma import reset
  177. #endif
  178.  
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182.  
  183. #endif /* __TIMER__ */
  184.  
  185.